package com.zsc.newbuds.controller.admin;

import com.zsc.newbuds.entity.DonationArea;
import com.zsc.newbuds.service.impl.DonationAreaServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author D
 */
@RequestMapping("admin/DonationAreaManagement")
@Controller
public class DonationAreaController {

    @Autowired
    DonationAreaServiceImpl donationAreaService;

    @PostMapping("/addDonationArea")
    public void addDonationArea(String city,String detailAddress){
        DonationArea donationArea = new DonationArea();
        donationArea.setDonationAreaCity(city);
        donationArea.setDonationAreaAddress(detailAddress);
        donationAreaService.addDonationArea(donationArea);
    }

    @ResponseBody
    @GetMapping("/getDonationAreaList")
    public List<DonationArea> getDonationAreaList(){
        return donationAreaService.getDonationAreaList();
    }
}
